home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Aminet 1 (Walnut Creek)
/
Aminet - June 1993 [Walnut Creek].iso
/
usenet
/
sources
/
volume90
/
aplictns
/
route_10
/
part02
/
pcbroute.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-04-23
|
4KB
|
119 lines
/*
** printed circuit board autorouter, Copyright (C) Randy Nevin 1989.
**
** you may give this software to anyone, make as many copies as you like, and
** post it on public computer bulletin boards and file servers. you may not
** sell it or charge any fee for distribution (except for media and postage),
** remove this comment or the copyright notice from the code, or claim that
** you wrote this code or anything derived from it. you may modify the code as
** much as you want (please document clearly with comments, and maintain the
** coding style), but programs which are derived from this one are subject to
** the conditions stated here. i am providing this code so that people can
** learn from it, so if you distribute it, please include source code, not
** just executables. contact me to report bugs or suggest enhancements; i do
** not guarantee support, but i will make an effort in good faith to help you,
** and i want to act as a central clearing house for future versions. you
** should contact me before undertaking a significant development effort, to
** avoid reinventing the wheel. if you come up with an enhancement you
** consider particularly useful, i would appreciate being informed so that it
** can be incorporated in future versions. my address is: Randy Nevin,
** 1731 211th PL NE, Redmond, WA 98053. this code is available directly from
** the author; just send a floppy and a self-addressed floppy mailer with
** sufficient postage.
**
** HISTORY
** (name date description)
** ----------------------------------------------------
** randy nevin 2/1/89 initial version
** randy nevin 2/4/89 made retrace table driven, instead of
** doubly-nested switch statements.
** randy nevin 2/4/89 changed dir from int to char (cut
** storage for it in half).
** randy nevin 2/8/89 changed SetQueue and ReSetQueue to
** give priority to goal nodes.
** randy nevin 2/11/89 don't output incremental search
** results if stdout is redirected.
** randy nevin 2/11/89 released version 1.00
** udi finkelstein 2/27/90 amiga port, added single side switch.
*/
#include <stdio.h>
/*
#ifndef M_XENIX
#include <stdlib.h>
#include <io.h>
#endif
*/
#include <time.h>
/*
#include <string.h>
*/
extern char *strrchr();
#include "cell.h"
/* #define ERR -1 if you want the original */
#define ERR 10
/*
** if you run out of memory while routing large boards, there are two things
** you can do: (1) go into your config.sys file and disable everything you
** don't need. getting rid of things like ansi.sys, ramdisks, disk caches, and
** other terminate and stay resident (tsr) programs can free a lot of memory.
** (2) link the router, inspect the .map file, relink with the /CPARMAXALLOC:n
** switch, where n is calculated to allow for a near heap of about 5k. read
** the linker documentation before you do this. for me, the route.map file
** says the program needs 81EFh bytes. to this i add 1400h (5k) for a near
** heap to get 95EFh bytes or 95Fh paragraphs, which is 2399 decimal.
*/
int justboard = 0; /* need all data structures, not just the board */
int one_side = 0; /* udi 27-2-90 single sided board flag */
extern void Initialize();
extern void Solve();
extern void Report();
void main ( argc, argv ) /* input board, route traces, output routed board */
int argc;
char *argv[];
{
char *self, *p;
FILE *fin, *fout;
long start, stop;
int argcount=0;
printf( "Copyright (C) Randy Nevin, 1989. Version 1.00\n" );
printf( "See source code for rights granted.\n\n" );
printf( "Amiga Port by Udi Finkelstein\n\n" );
start = time( NULL );
self = argv[argcount++];
/* get rid of initial part of path */
if ((p = strrchr( self, '/' )) || (p = strrchr( self, ':' )))
self = ++p;
if (argc < 3) { /* need infile and outfile */
printf( "usage: %s [-s] infile outfile\n", self );
exit( ERR );
}
if (strcmp(argv[argcount],"-s") == 0) {
one_side = 1;
argcount++;
} else one_side = 0;
if (!(fin = fopen( argv[argcount++], "r" ))) {
printf( "can't open %s\n", argv[1] );
exit( ERR );
}
if (!(fout = fopen( argv[argcount++], "w" ))) {
printf( "can't open %s\n", argv[2] );
exit( ERR );
}
Initialize( fin );
Solve();
Report( fout );
stop = time( NULL ) - start;
printf( "time = %ld second%s\n", stop, (stop == 1) ? "" : "s" );
exit( 0 );
}